import 'package:dio/dio.dart';
import 'package:login_model/data/token_data.dart';
import 'package:retrofit/retrofit.dart';
import 'package:json_annotation/json_annotation.dart';
part 'login_model.g.dart';

/**
 *
 * @ProjectName:    login_model
 * @ClassName:      login_model
 * @Description:    dart类作用描述
 * @Author:         孙浩
 * @QQ:             243280864
 * @CreateDate:     2021/1/8 7:44 PM
 */

@RestApi(baseUrl: "https://dev-h5.365jiake.com")
abstract class LoginModel {
  factory LoginModel(Dio dio,{String baseUrl}) = _LoginModel;

  @POST("/appapi/account/loginbypwd")
  Future<TokenData> loginByPassowrd(@Body() LoginData loginData);
}


@JsonSerializable()
class LoginData{
  String tel;
  String pwd;
  String deviceToken;

  LoginData({this.tel, this.pwd, this.deviceToken});

  factory LoginData.fromJson(Map<String, dynamic> srcJson) => _$LoginDataFromJson(srcJson);

  Map<String, dynamic> toJson() => _$LoginDataToJson(this);

}